package gov.ccswj.modules.bdbusiness.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import gov.ccswj.modules.bdbusiness.entity.AWmEntity;
import gov.ccswj.modules.bdbusiness.entity.BBProjectEntity;
import gov.ccswj.modules.bdbusiness.service.AWmService;
import gov.ccswj.modules.bdbusiness.service.LayoutService;
import gov.ccswj.common.utils.PageUtils;
import gov.ccswj.common.utils.Query;
import gov.ccswj.common.utils.R;

/**
 * 
 * 
 * @author KY.Cheng
 * @email ********@gmail.com
 * @date 2017-11-29 17:17:15
 */
@RestController
@RequestMapping("/bdbusiness/layout")
public class LayoutController {
	@Autowired
	private LayoutService layoutService;
	/**
	 */
	@RequestMapping("/{type}")
	@RequiresPermissions("bdbusiness:bbproject:info")
	public R info(@PathVariable("type") String type){
		List<Map<String, Object>> list = new ArrayList<>();
		String[] types = type.split(",");
		for (String string : types) {
			List<Map<String, Object>> l = layoutService.queryLayout(string);
			if(l!=null && l.size()>0) {
				list.addAll(l);
			}
		}
		return R.ok().put("list", list);
	}
}
